package io.github.jast90.internship.service;

import io.github.jast90.internship.entity.MyClass;
import io.github.jast90.internship.mapper.MyClassMapper;
import io.github.jast90.internship.util.SessionUtil;
import io.github.jast90.web.common.result.CommonResult;
import io.github.jast90.web.common.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by jast90 on 2021/3/8
 */
@Service
public class MyClassService extends BaseService<MyClassMapper, MyClass> {
    @Autowired
    private SessionUtil sessionUtil;

    @Override
    public CommonResult<List<MyClass>> queryListByCondition(MyClass myClass) {
        if(sessionUtil.student()){
            myClass.setStudentId(sessionUtil.getUid());
        }
        return super.queryListByCondition(myClass);
    }
}
